<template>
  <div class="container">
    <div>
      <h2 style="color: #ffffff">抱歉! 页面不存在</h2>
      <h1>404</h1>
      <p style="font-weight: bold;color: #F4F4F4">ChatPet无法找到该页面</p>
      <div class="back-button" @click="goToHome">返回首页</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "404",
  mounted() {
    this.initLanguage();
  },
  methods:{
    initLanguage(){
      let lan = localStorage.getItem('language');
      if(lan){
        if(lan=='en'){
          this.$i18n.locale='en';
        }else{
          this.$i18n.locale='zn';
        }
      }else{
        this.$i18n.locale='zn';
        localStorage.setItem('language','zn');
      }
    },

    goToHome(){
      this.$router.push('/home')
    }
  }
}
</script>

<style scoped lang="less">
.container{
  width: 100%;
  height: 100vh;
  color: #343434;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  background-image: linear-gradient(125deg,#4890FE,blueviolet);
}

.container h1{
  font-size: 200px;
  margin: 0;
  font-weight: 900;
  letter-spacing: 20px;
}

.back-button{
  margin-top: 30px;
  text-decoration: none;
  background: #4890FE;
  color: #ffffff;
  font-weight: bold;
  padding: 12px 24px;
  display: inline-block;
  border-radius: 25px;
  font-size: 14px;
  text-transform: uppercase;
  transition: 0.4s;
}

.back-button:hover{
  background: darkslateblue;
}
</style>
